function Start()
{
	var dataTransfer : DataTransfer = GameObject.Find("MenuControl").GetComponent(DataTransfer);

	for (var cnt : int = 0; cnt < dataTransfer.cubePosVectTable.length; cnt = cnt + 1)
	{
		CreateCube(dataTransfer.cubePosVectTable[cnt], dataTransfer.cubeSizeVectTable[cnt]);
	}

	for (cnt = 0; cnt < dataTransfer.cylinderPosVectTable.length; cnt = cnt + 1)
	{
		CreateCylinder(dataTransfer.cylinderPosVectTable[cnt], dataTransfer.cylinderSizeVectTable[cnt]);
	}
}

function CreateCube(pos : Vector3, scale : Vector3)
{
	var cube : GameObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
	cube.AddComponent(BoxCollider);
	cube.collider.enabled = true;
	cube.transform.position = pos;
	cube.transform.localScale = scale;
	
	var agentSet : AgentSet = GameObject.Find("Main Camera").GetComponent(AgentSet);
	for (var i : int = 0; i < agentSet.agents.length; i= i+1) 
	{
        agentSet.agents[i].primitivesTable.Push(cube);
    }
}

function CreateCylinder(pos : Vector3, scale : Vector3)
{
	var cylinder : GameObject = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
	cylinder.AddComponent(SphereCollider);
	cylinder.collider.enabled = true;

	cylinder.transform.position = pos;
	if (Mathf.Abs(pos.x) + scale.x > 5)
	{
		scale.x = 4.5 - Mathf.Abs(pos.x);
		scale.z = scale.x;
	}

	if (Mathf.Abs(pos.z) + scale.z > 5)
	{
		scale.z = 4.5 - Mathf.Abs(pos.z);
		scale.x = scale.z;
	}
	cylinder.transform.localScale = scale;
	
	var agentSet : AgentSet = GameObject.Find("Main Camera").GetComponent(AgentSet);
	for (var i : int = 0; i < agentSet.agents.length; i= i+1) 
	{
        agentSet.agents[i].primitivesTable.Push(cylinder);
    }
}
